# coding: utf-8
import cv2


class ImageProcess(object):
    def __init__(self):
        pass

    @staticmethod
    def compare_two_image(image1, image2, threshold=0.9):
        method = eval('cv2.TM_CCOEFF_NORMED')
        img1 = cv2.imread(image1, 0)
        img2 = cv2.imread(image2, 0)
        res = cv2.matchTemplate(img2, img1, method)
        min_val, max_val, min_loc, max_loc = cv2.minMaxLoc(res)
        if max_val >= threshold:
            return True
        return False


